package caiwei.android_study_sample.activity;

import caiwei.android_study_sample.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class Android08DataPersistenceSampleList extends Activity
{
	ListView mListView;
	private String[] mArr;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		mListView = (ListView) findViewById(R.id.lv);
		mArr = getResources().getStringArray(R.array.datapersistencesampleitem);
		ArrayAdapter<String> _ArrayAdapter = new ArrayAdapter<String>(this,
				android.R.layout.simple_expandable_list_item_1, mArr);
		mListView.setAdapter(_ArrayAdapter);
		mListView.setOnItemClickListener(new OnItemClickListener()
		{

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id)
			{
				switch (position)
				{
				case 0:
					Intent _Intent0 = new Intent(
							Android08DataPersistenceSampleList.this,
							Android08DatapersistenceSampleSharePreference.class);
					startActivity(_Intent0);
					break;
				case 1:
					Intent _Intent1 = new Intent(
							Android08DataPersistenceSampleList.this,
							Android08DataPersistenceSampleFile.class);
					startActivity(_Intent1);
					break;
				case 2:
					Intent _Intent2 = new Intent(
							Android08DataPersistenceSampleList.this,
							Android08DataPersistenceNetwork.class);
					startActivity(_Intent2);
					break;
				case 3:
					Intent _Intent3 = new Intent(
							Android08DataPersistenceSampleList.this,
							Android08DataPersistenceSampleSQLite.class);
					startActivity(_Intent3);
					break;
				case 4:
					Intent _Intent4 = new Intent(
							Android08DataPersistenceSampleList.this,
							Android08DataPersistenceSampleSetting.class);
					startActivity(_Intent4);
					break;

				default:
					break;
				}
			}
		});
	}
}
